package net.minecraft.src;

import java.util.Random;

public class PPHGenAlgae extends WorldGenerator
{

    public PPHGenAlgae()
    {
    }

    public boolean generate(World world, Random random, int i, int j, int k)
    {
        for(int l = 0; l < 128; l++)
        {
            int i1 = (i + random.nextInt(8)) - random.nextInt(8);
            int j1 = (j + random.nextInt(1)) - random.nextInt(1);
            int k1 = (k + random.nextInt(8)) - random.nextInt(8);
            if(world.isAirBlock(i1, j1, k1) && world.getBlockId(i1, j1 - 1, k1) == Block.waterStill.blockID && (world.getBlockId(i + 8, j - 1, k) == mod_pph.prehistoricGrass.blockID || world.getBlockId(i - 8, j - 1, k) == mod_pph.prehistoricGrass.blockID || world.getBlockId(i, j - 1, k + 8) == mod_pph.prehistoricGrass.blockID || world.getBlockId(i, j - 1, k1 - 8) == mod_pph.prehistoricGrass.blockID || world.getBlockId(i, j - 2, k) == mod_pph.prehistoricGrass.blockID || world.getBlockId(i, j - 3, k) == mod_pph.prehistoricGrass.blockID || world.getBlockId(i, j - 4, k) == mod_pph.prehistoricGrass.blockID))
            {
                world.setBlock(i1, j1, k1, mod_pph.algae.blockID);
            }
        }

        return true;
    }
}
